# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pyhunter
pkgname=('python2-pyhunter' 'python-pyhunter')
_pkgname=pyhunter
pkgver=1.7
pkgrel=6
pkgdesc='An (unofficial) Python wrapper for the Hunter.io API.'
arch=('any')
url='https://pypi.org/project/pyhunter/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('6cffe3f8bf08a931c20b7eeb3f209f6393a7e9b35d871195f6249589ac7d8f4c8152b94b957ea407cc103c1bc1625e82da4a12d3ece4b0810ad2b4286a6c8d4a')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pyhunter() {
  depends=('python2' 'python2-requests')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-pyhunter() {
  depends=('python' 'python-requests')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

